Skip to content

fix: align Python API to MATLAB signatures (5 critical mismatches)#73

Merged
iahncajigas merged 7 commits intomainfrom
fix/api-parity-matlab-alignment
Mar 22, 2026
Merged

fix: align Python API to MATLAB signatures (5 critical mismatches)#73
iahncajigas merged 7 commits intomainfrom
fix/api-parity-matlab-alignment

Conversation

@iahncajigas
Copy link
Copy Markdown
Contributor

Summary

Aligns Python API to MATLAB for 5 critical signature mismatches identified by cross-toolbox audit:

  • ConfidenceInterval: Add SignalObj-compatible methods (MATLAB inherits ~70 methods via < SignalObj)
  • FitResult.getCoeffs/getHistCoeffs: Return (coeffMat, labels, SEMat) 3-tuple matching MATLAB
  • nstColl.psthGLM: Accept MATLAB params (basisWidth, history, selectorArray, minTime, maxTime, sampleRate)
  • kalman_filter: Accept both MATLAB positional and Pythonic keyword signatures
  • boxplot: Fix pre-existing tick_labelslabels matplotlib compat issue

Test plan

  • All 264 tests pass locally (0 failures)
  • CI passes

🤖 Generated with Claude Code

Iahn Cajigas and others added 7 commits March 22, 2026 14:08
1. ConfidenceInterval: add SignalObj-compatible methods (getSigInTimeWindow,
   windowedSignal, shift, resample, derivative, merge, copySignal, etc.)
   matching MATLAB's inheritance from SignalObj

2. FitResult.getCoeffs: now returns (coeffMat, labels, SEMat) 3-tuple
   matching MATLAB [coeffMat, labels, SEMat] = getCoeffs(fitObj, fitNum)

3. FitResult.getHistCoeffs: same 3-tuple return matching MATLAB

4. nstColl.psthGLM: accepts MATLAB-compatible params (basisWidth, history,
   fitType, selectorArray, minTime, maxTime, sampleRate) while keeping
   Python aliases (binwidth, windowTimes)

5. kalman_filter: accepts both MATLAB positional (A, C, Pv, Pw, Px0, x0, y)
   and Pythonic keyword (observations, transition, ...) signatures

Also fixes:
- matplotlib boxplot tick_labels → labels (pre-existing compat issue)
- Regenerates notebook_fidelity.yml with current date
- Updates all call sites for getCoeffs/getHistCoeffs 3-tuple return

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Notebooks had bare `fitResults.getCoeffs(2)` calls that now return
a (coeffMat, labels, SEMat) tuple. Add [0] indexing to extract the
coefficient array where needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The committed .ipynb files are executed by CI directly. Regenerate
them from the builder scripts (already fixed) so the notebook cells
use getCoeffs(n)[0] to extract the coefficient array from the tuple.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use version-aware boxplot kwarg: tick_labels (mpl>=3.9) or labels (older)
- Align notebook parity notes from high_fidelity to exact (matches parity_notes.yml)
- Regenerate AnalysisExamples.ipynb and AnalysisExamples2.ipynb

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test checks that YAML remaining_differences text appears verbatim
in the notebook's parity note cell. Update YAML to match builder output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Auto-extracted fidelity_status and remaining_differences from each
committed notebook to ensure the YAML matches the builder output.
Several notebooks use high_fidelity (not exact) per their builders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Report now shows 6 exact + 7 high_fidelity (was 13 exact + 0 high_fidelity)
to match actual notebook builder output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@iahncajigas iahncajigas merged commit 375f977 into main Mar 22, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant